Skip to content

feat(spec,plugin-audit): an activity milestone's timeline row reads in the reader's language - #37582

Draft
objectstack-fleet[bot] wants to merge 6 commits into
mainfrom
claude/project-thread-gvxx96-37524
Draft

objectstack-fleet[bot] wants to merge 6 commits into
mainfrom
claude/project-thread-gvxx96-37524

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Fixes #37524

Clause-②: yes (widening)
Metadata-protocol: added
Skills-docs: follow-up #37585

维护者速读

  • 用户能看到什么变化:应用声明的「活动里程碑」(例如工单关闭、商机赢单)写在记录时间线上的那一行,现在按读者的语言显示:应用在翻译包里给这条里程碑写了中文模板,中文用户看到的就是中文句子,句子里的下拉值也显示成中文选项名;没写译文的语言照旧显示作者原文。
  • 为什么做:以前这一行永远是作者写的语言,翻译包里没有放它的位置,应用自己没法改(HotCRM 的工单、商机时间线就是这样)。
  • 出错会怎样:存下来的行文字不变,只在读的时候换成译文;译文缺失、读请求不带语言、或者是这次改动之前写的旧行,都显示原文。字段权限的遮蔽规则照旧:读者看不到的字段参与拼出的句子,任何语言下都不给。
  • 要你做什么:无。技能文档 skills/objectstack-i18n 补一句的后续卡是 skills: objectstack-i18n lists the object translation sub-keys but not _milestones.<field>.<value>.summary once PR #37582 lands #37585。

What changes

The reading (at 4116465625): the timeline already serves most rows in the reader's language — the CRUD mirror stores a summary CODE beside the sentence and the sys_activity read middleware re-composes it per reader (packages/plugins/plugin-audit/src/activity-summary-message.ts). A fired milestone was the one row left out, by an implementation note in that file ("its template is the author's sentence and is never translated"), and ObjectTranslationDataSchema had no key the template could be translated under. ADR-0052 §5b.2 defines the milestone and says nothing about its language.

  • Spec, translation slot (packages/spec/src/system/translation.zod.ts). An object translation accepts _milestones: { <field>: { <value>: { summary } } }. A milestone declares no name; the watched field and the value it fires on are what fire it (the writer fires the first declared match), so the pair is its address and no new authorable key is added to activityMilestones. milestones / activityMilestones alias the group, as validations aliases _validations.
  • Spec, resolver (packages/spec/src/system/i18n-resolver.ts). resolveObjectMilestoneSummary(bundle, object, field, value, opts) reads the template along the locale chain; a dotted value is one key. It is deliberately NOT overlaid by translateObject: an object served by /meta with the translated template on it would round-trip into the authored declaration on the next Studio save. A pin holds that translateObject leaves activityMilestones[].summary as authored.
  • Writer (packages/plugins/plugin-audit/src/audit-writers.ts). A fired milestone's row now carries metadata.summary_message = { key: 'activityMilestone', object, field, value, tokens }, each token stored as the field-change code stores a value: the text the writer rendered, plus the select option it matched. The stored summary is unchanged (the authored sentence, rendered as before), and so are type, metadata.kind and the text sources the redaction reads.
  • Reader (activity-summary-message.ts). readerSummaryLocale gains milestoneSummary, which reads the template from the same bundle and ResolveOptions the labels are translated with. composeActivitySummary interpolates it: a select token is named by the option label on the reader-language object definition, any other token by its stored text, and a token with no stored value (a token the translation adds, or an empty value) renders empty, as an empty value does in the authored sentence. No template for the reader's language ⇒ nothing is composed and the stored sentence stands. A tenant that reworded a packaged milestone's summary keeps its words (ADR-0029 D9.2a, judged as a reworded validation message is: the served milestone against the packaged one of the same pair). The code is stripped from metadata for every non-system reader, as the other non-field-change codes are.
  • Redaction, unchanged. The milestone's token fields were already the summary's declared text sources, so a reader not served one has the summary dropped before this middleware runs; the middleware only overlays a summary still present, so it never re-adds a dropped one. Pinned below.
  • Lint. The extractor (i18n-walk.ts) scaffolds objects.<o>._milestones.<field>.<value>.summary for each pair, the first entry of a repeated pair only. The translation-reference rule (validate-translation-references.ts) flags a _milestones key over a pair no milestone of the object declares, suggesting the near value.
  • Example. examples/app-showcase translates its one milestone (showcase_task, status → done) in zh-CN, so the extractor's new key is translated where the coverage gate measures it.
  • Docs. content/docs/ui/translations.mdx (the key table) and content/docs/protocol/kernel/i18n-standard.mdx (the reference rule's table) name the key. content/docs/references/system/translation.mdx, api-surface/system.json, export-origins/system.json and the strictness-ledger count (system/ 409 → 410, the new strict object) regenerated by check:generated --fix.

Small calls made here (no card): the field + value address rather than a new name on a milestone; a boolean token keeps rendering its stored value (as the authored sentence does today) rather than a per-locale yes/no word; token texts are not length-bounded in the code (the authored sentence they come from is not bounded either).

Why

An app that is otherwise fully translated still wrote authoring-language rows ("Case escalated — …") on the record timeline, with no key it could fill in.

Verification

  • packages/plugins/plugin-audit/src/activity-milestone-summary-locale.integration.test.ts (new; real kernel, real audit writer, SQLite, the engine middleware chain): a zh-CN reader reads 商机赢单:Acme(赢单) from the zh-CN template with the {stage} token named by its zh-CN option label; the system, an en reader, a read with no locale and a ja-JP reader (no entry) read the stored Deal won: Acme (Won); the code is stored for the system and served to no other caller; a reader not served a token's field (note) gets the row with no summary. Red first: with the composer's template lookup stubbed out, the zh-CN pin and the redaction pin's served half fail (2 of 4).
  • activity-summary-message.test.ts, new describe: composes the translated template, an unstored token empty; nothing composed for a locale with no entry or on a locale with no milestoneSummary; a tenant's rewording of the packaged milestone keeps its words while the untouched one translates; the stored code reads back and a malformed one is refused.
  • packages/spec/src/system/i18n-milestone-summary.test.ts (new): the key is read by pair, a dotted value as one key, along the fallback chain, undefined on misses; the schema accepts the group and refuses a key it does not declare; translateObject leaves the authored summary.
  • packages/lint/src/i18n-milestones-37524.test.ts (new): the extractor emits one key per fired pair seeded with the authored template; the reference rule resolves declared pairs and flags an undeclared value (with the suggestion) and an unwatched field.
  • validate-translation-references.test.ts: the lint: validate-translation-references has no _tabs leg — an authored key naming a filter-preset tab that does not exist warns nobody #13835 object-branch coverage ledger classifies _milestones as reference-checked, backed by a ghost that reports, and the all-groups control bundle names the real pair.
  • Local runs at 92e8e1bcf: @objectstack/plugin-audit vitest 110 files / 1,840 tests pass; @objectstack/lint vitest 237 files / 9,683 tests pass (the one red, the coverage ledger, fixed in the tip commit and re-run: 268/268); @objectstack/spec vitest src/system pass; node scripts/check-i18n-bundles.mjs exit 0; eslint on the touched files exit 0; tsc --noEmit for plugin-audit exit 0; pnpm --filter @objectstack/spec check:generated exit 0; node scripts/pm/overlap-check.mjs exit 0. check:i18n-coverage needs the built examples and is left to CI.

Contract review (L2) is owed before landing: the diff changes packages/spec/src/** and declares Clause-②: yes (widening).

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgUpnvPnJ1hR74pUrVj


Generated by Claude Code

@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation protocol:system tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/lint, @objectstack/plugin-audit, @objectstack/spec, touching 20 documentable anchor(s). ⚠️ 3 changed file(s) yielded no anchor (packages/spec/api-surface/system.json, packages/spec/authorable-surface/system.json, packages/spec/export-origins/system.json), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

1 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/frontend/plugins/plugin-detail.mdx (via fieldChanges (literal, a string literal in ActivitySummaryMessage))
What this run could not see
  • 3 changed file(s) yielded no anchor (packages/spec/api-surface/system.json, packages/spec/authorable-surface/system.json, packages/spec/export-origins/system.json) — pages documenting those are invisible to this run
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 180 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 6c290d3af7c52d019d1de1c09b6b0306f09700bb → packageMentionDocs.

Which tree this was computed on

This run read content/docs from bdb51e38990bbad0b9e66ea8dbcfad020d63abbb — the merge of head 578a08d188abbe34f068395203243db11371a8a5 into base 6c290d3af7c52d019d1de1c09b6b0306f09700bb, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin bdb51e38990bbad0b9e66ea8dbcfad020d63abbb && git checkout bdb51e38990bbad0b9e66ea8dbcfad020d63abbb
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6c290d3af7c52d019d1de1c09b6b0306f09700bb 578a08d188abbe34f068395203243db11371a8a5 && git checkout -B drift-repro 6c290d3af7c52d019d1de1c09b6b0306f09700bb && git merge --no-ff 578a08d188abbe34f068395203243db11371a8a5

node scripts/docs-audit/affected-docs.mjs --json 6c290d3af7c52d019d1de1c09b6b0306f09700bb

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 6c290d3af7c52d019d1de1c09b6b0306f09700bb → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Test Core (5/10) on 578a08d18 (job 139970139703) is red on one case, and the case is not this PR's.

  • What fails: packages/cli/test/start-deployment-durability.integration.test.ts, case #30120 … a switch value that is not a switch is refused too, with Test timed out in 5000ms. feat(spec): Studio metadata-form select choices are translatable (metadataForms options slot) #37569 failed the same way on a sibling case of that describe (only the database missing), which passed on re-run.
  • Root cause: the three #30120 … a start missing its settings refuses cases spawn os start with spawnSync(…, { timeout: 120_000 }), but the cases declare no test timeout, so vitest's 5 s default applies. Locally each case takes about 1.8 s; a loaded runner goes past 5 s. The #31600 describe in the same file already gives its spawn legs LEG_TIMEOUT_MS (SPAWN_TIMEOUT_MS + 10_000).
  • Why not this PR's: this diff touches packages/spec, packages/plugins/plugin-audit, packages/lint, docs and an example, and nothing under packages/cli or the start path. main's push runs are green.
  • Fix: give the three cases the same per-case timeout. It is a one-file test change, so it is proposed to the seat as a separate card rather than folded into this PR. A single re-run of the shard is requested meanwhile.

Generated by Claude Code

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Re-run once · 2026-11-26T14:48Z · head 578a08d · run 45837008571

One red on this head: Test Core (5/10), job 139970139703, in packages/cli/test/start-deployment-durability.integration.test.ts:298 ("a switch value that is not a switch is refused too"), with Test timed out in 5000ms.

The cause is named, and it is not this PR's. The #30120 cases spawn os start synchronously with a 120 s spawn allowance but run under vitest's 5 s case default, so a loaded runner reds them. The same shard went red the same way on PR #37569 an hour ago (a different case of that describe), and its re-run was green. The fix is filed as #37601. This PR touches no packages/cli file.

So the failed jobs are re-run once through the relay. A second red on this PR would be read as real.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:system size/l tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

activityMilestones summary has no translation slot, so an app cannot localize the timeline rows its milestones write

2 participants